package com.nondo.rdp.core.service.impl;

import com.nondo.rdp.core.domain.Rules;
import com.nondo.rdp.core.repository.RulesRepository;
import com.nondo.rdp.core.service.RulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class RulesServiceImpl implements RulesService {
    @Autowired
    RulesRepository rulesRepository;

    @Override
    public Rules findOne(Long id) {
        return this.rulesRepository.findOne(id);
    }

    @Override
    public Rules save(Rules rules) {
        return this.rulesRepository.save(rules);
    }

    @Override
    public void update(Rules rules) {
        this.rulesRepository.save(rules);
    }

    @Override
    public void delete(Long id) {
        this.rulesRepository.deleteById(id);
    }

    @Override
    public Rules findByType(String type) {
        return this.rulesRepository.findByType(type);
    }

    @Override
    public List<Rules> findAll() {
        return this.rulesRepository.findAll();
    }
}